# -*- coding:utf-8 -*-
# exceptions.py

class ORMError(Exception):
    """ORM 基础异常"""
    pass

class ConfigurationError(ORMError):
    """配置不合法引发的异常"""
    def __init__(self, message: str = "配置错误"):
        super().__init__(message)

class DBConnectionError(ORMError):
    """数据库连接失败异常"""
    pass

class QueryError(ORMError):
    """查询条件不合法异常"""
    pass

class SearchError(ORMError):
    """搜索相关异常基类"""
    pass

class IndexNotExistError(SearchError):
    """索引未创建异常"""
    def __init__(self, model_name: str):
        super().__init__(f"模型 {model_name} 的 RediSearch 索引未创建，请先调用 create_search_index")
